package service;

import dao.CroRootDao;
import entity.CroRole;
import entity.CroRoot;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by xuweijie on 17-5-7.
 */
@Service
public class CroRootService {

    @Autowired
    private CroRootDao croRootDao;


    /**
     * 查找出全部
     * */
    @Transactional(readOnly = true)
    public List<CroRoot> FindAllRoot(){
        String hql="from CroRoot";
        List<CroRoot> croRoots=croRootDao.findList(hql);
        return croRoots;
    }

    /**
     * 根据id查找相应的权限
     * */
    @Transactional(readOnly = true)
    public CroRoot FindRootById(String id){
        CroRoot croRoot=croRootDao.getById(id);
        return croRoot;
    }
}
